


class OrtakAlan {

	private static int deger; 
	public synchronized static int sayiVer() {

		deger++;
		System.out.println( Thread.currentThread().getName() + "-->" + deger);
		return deger;

	}
}


public class StatikTest extends Thread {

	private OrtakAlan oa ; 
	
	public StatikTest(OrtakAlan oa) {
		this.oa = oa ;
	}

	public void run() {

		for (int i=0; i<5; i++) {
			oa.sayiVer();
			
			try {
				Thread.sleep(1);
			} catch ( InterruptedException iEx ) { 
				// bosver
			}

		}
	}


	public static void main(String args[]) throws Exception {

		OrtakAlan oa = new OrtakAlan();
		StatikTest st1 = new StatikTest(oa);
		StatikTest st2 = new StatikTest(oa);

		st1.start();
		st2.start();


	}
}
